<template>
    <div class="cbox">
        <h5>子组件</h5>
        <div>来自父组件的msg:{{ msg }}</div>
        <input type="button" value="printMsg" @click="printMsg()">
        <div>info{{ info}}</div>
        <input type="button" value="发送数据" @click="senddata()">
        

    </div>
</template>
<script setup>
import { defineProps, ref, defineEmits,defineExpose } from 'vue'
 let props=defineProps({
    msg:{
        type:String,
         default: ""
    }
 })
let emit= defineEmits(["updata:info"])
function printMsg(){
    console.log(props);
    console.log(props.msg);   
}
let senddata=function(){
    emit('updata:info',info.value)
}
let info=ref('子组件 info 变量')

let printTest=function(){
    console.log('子组件方法');
    
}
defineExpose({
    printTest
})
</script>